<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
<title><spring:message code="message.lable.compprofileSTDsee"/></title>
 <%@ include file="/WEB-INF/component/commonCSS.jsp" %>
<!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
    <style type="text/css">
    .box-body{
    margin-top:-10px;
    }    	
    </style>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.lable.compprofileSTDsee"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.StdManage"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.compprofileStd"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.profileSeeStd"/></a></li>
        </ol>
    </section>

    <section class="content">
      <form id="form" method="post" class="form-horizontal">
        <div class=" box box-success">
            <div class="box-body">
                <div class="input">
                <div class="textalign1"><spring:message code="message.listForm.qiYeMingCheng"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="compName" placeholder="<spring:message code="message.listForm.qiYeMingCheng"/>"/>
                    </div>
                <div class="textalign"><spring:message code="message.listForm.qiYeBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="compCode" placeholder="<spring:message code="message.listForm.qiYeBianMa"/>" />
                    </div>
                    
                    
                    <div class="textalign"><spring:message code=""/><spring:message code="message.lable.qiYeZhuCeLeiXing"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                       <table style="width:100%;">
                           <tr>
                              <td style="width:50%">
                              <select class="textinput" id="compRegId"></select>
                              </td>
                              <td style="width:50%">
                              <select class="textinput" id="compRegId2"></select>
                              </td>
                           </tr>                          
                       </table>
                    </div>
                </div>
                <div class="input" style="margin-top:-3px;">
                    <div class="textalign1"><spring:message code="message.listForm.qiYeLeiXing"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <select class="textinput" id="selectId">
                            <option value=""><spring:message code="message.select.option"/></option>
                            <option value="1"><spring:message code="message.model.shengChangeQiYe"/></option>
                            <option value="2"><spring:message code="message.model.peiSongQiYe"/></option>
                        </select>
                    </div>
                    <div class="textalign"><spring:message code="message.listForm.suoShuDiQu"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                       <table style="width:100%;">
                           <tr>
                              <td style="width:33%">
                                <select class="textinput" id="area1"></select>
                       	      </td>
                              <td style="width:33%">   
                                <select class="textinput" id="area2" name="area2" ></select>
                                </td>
                              <td style="width:33%">
                                <select class="textinput" id="area3" name="area3" ></select>
                              </td>
                           </tr> 
                        </table>
                    </div>

                    <div class="textalign"><spring:message code="message.lable.zhuangTai"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <select class="textinput" name="status" id="status">
                            <option value=""><spring:message code="message.select.option"/></option>
                            <option value="1"><spring:message code="message.button.start"/></option>
                            <option value="2"><spring:message code="message.button.stop"/></option>
                            <option value="3"><spring:message code="message.button.combine"/></option>
                        </select>
                    </div>
                </div>
                <div class="input">
                    <div class="textalign1" >
                          <button id="selectView" type="button" onclick="likeQuery();" class="btn btn-success btn-sm"><spring:message code="message.button.seachSpacing"/></button>
                    </div> 
                </div>    
            </div>
          </div>
        </form>
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp" %>
    <script src="${ctx}/lib/plugins/daterangepicker/moment.js"></script>
    <script src="${ctx}/lib/plugins/daterangepicker/daterangepicker.js"></script>
    <script type="text/javascript">
    
  //绑定回车
    $('#selectId,#area1,#area2,#area3,#compRegId,#compRegId2,#compCode,#compName,#status').bind('keydown', function(event) {
        if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
            $('#selectView').click();
        }
    }); 
  
    $("#compName").focus();//加载页面光标在第一个查询框内
    
        $(function() {
              $("#area1").HNSelect({
                    url: "${pageContext.request.contextPath}/selectController/getArea.html", data: { ID: '000000' },  defaultText: "<option value=''><spring:message code='message.select.option'/></option>",
                    func: function () {
                        $("#area2").HNSelect({
                            parent_selector: "#area1", url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID",defaultText: "<option value=''><spring:message code='message.select.option'/></option>",
                                      func: function () {
                                          $("#area3").HNSelect({
                                              parent_selector: "#area2", url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID", defaultText: "<option value=''><spring:message code='message.select.option'/></option>"
                                          });
                                      }
                        });
                    }
                });
              
              $("#compRegId").HNSelect({
                    url: "${pageContext.request.contextPath}/selectController/getDicCompType.html", data: {compRegId:""},  defaultText: "<option value=''><spring:message code='message.select.option'/></option>",
                        func: function () {
                            $("#compRegId2").HNSelect({
                                parent_selector: "#compRegId", url: "${pageContext.request.contextPath}/selectController/getDicCompType.html", dataid: "compRegId",defaultText: "<option value=''><spring:message code='message.select.option'/></option>"
                            });
                        }
                });
              
            $("#gridlist").jqGrid({
                url : "${ctx}/stdCompinfo/stdCompinfoList.html",
                mtype : "POST",
                datatype : "json",
                autowidth : true,
                height : 270,
                colNames : [ 
                             '<spring:message code="message.jqGrid.cz"/>',
                             'id', 
                             '<spring:message code="message.lable.qiYeBianMa"/>', 
                             '<spring:message code="message.lable.qiYeMingCheng"/>', 
                             '<spring:message code="message.listForm.qiYeLeiXing"/>',
                             '<spring:message code="message.lable.zuZhiJiGouDaiMa"/>',
                             '<spring:message code="message.lable.suoShuDiQu"/>', 
                             '<spring:message code="message.lable.qiYeZhuCeLeiXing"/>', 
                             '<spring:message code="message.lable.zhuangTai"/>' 
                             ],
                colModel : [
					{name : 'operate',width : 20,align : "center",sortable : false,
					    formatter : function(val, opts, rowdata) {
					        return "<ms:btn url='/compProfile/toCompProfileViewList.html'><a href='toCompProfileViewList.html?compId=" + rowdata.compId + "' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -40px -20px' class='opIcon' title='<spring:message code="message.jqGrid.cz.qualificationManagement"/>'></a></ms:btn>";
					    }
					},
                    {name : 'compId',width : 100,align : "center",hidden : true,sortable : false},
                    {name : 'compCode',width : 100,align : "center",sortable : false},
                    {name : 'compName',width : 160,align : "left",sortable : false},
                    {name : 'compType',width : 80,align : "center",sortable : false,
                        formatter : function(val, opts,
                                rowdata) {
                            var str = "";
                            if (rowdata.compType == 1) {
                                str = "<spring:message code='message.model.shengChangeQiYe'/>";
                            } else if (rowdata.compType == 2) {
                                str = "<spring:message code='message.model.peiSongQiYe'/>";
                            }
                            return str;
                        }
                    },
                    {name : 'orgCode',width : 80,align : "center",sortable : false},
                    {name : 'arFullname',width : 80,align : "center",sortable : false},
                    {name : 'compRegName',width : 80,align : "center",sortable : false},
                    {name : 'status',width : 60,align : "center",sortable : false,
                        formatter : function(val, opts,
                                rowdata) {
                            var str = "";
                            if (rowdata.status == 1) {
                                str = "<spring:message code='message.button.start'/>";
                            } else if (rowdata.status == 2) {
                                str = "<span class='red'><spring:message code='message.button.stop'/></span>";
                            } else if (rowdata.status == 3) {
                                str = "<spring:message code='message.button.combine'/>";
                            }
                            return str;
                    }
                }
                ],
                rowNum : 20,
                rowList : [ 10, 20, 50,100 ],
                rownumbers : true,
                pager : "#gridpage",
                multiselect : false,
                viewrecords : true,
                caption : "<spring:message code='message.list.compprofileStdlist'/>",
                jsonReader : {
                    repeatitems : false,
                    id : "ids"
                },
                gridComplete:function(){
                    //序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                    //数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                },
                /* gridComplete:function(){        
                    var page = $("#gridlist").jqGrid('getGridParam','page');
                    var rows = $('#gridlist').getGridParam("rowNum");
                    var maxnum = (rows*page).toString();
                    var len = (maxnum.length)*10;
                    $('.jqgfirstrow').find('td').eq(0).css('width',len+'px');
                    $('#gridlist_rn').css('width',len+'px');
                } */
            });
            
            $("#gridlist").jqGrid('navGrid', '#gridpage', {
                add : false,
                edit : false,
                del : false,
                search : false,
                refresh : false
            });

             $(window).trigger("resize");
        });

        function likeQuery() {
            var compType = $("#selectId").val();
            var areaId = "";
            if( "" != $("#area1").val() ){
                areaId = $("#area1").val();
            }
            if( "" != $("#area2").val()){
                areaId = $("#area2").val();
            }
            if( "" != $("#area3").val()){
                areaId = $("#area3").val();
            }

            var compRegId = "";
            if( "" != $("#compRegId").val()){
                compRegId = $("#compRegId").val();
            }

            if( "" != $("#compRegId2").val()){
                compRegId = $("#compRegId2").val();
            }
            
            var compCode = $("#compCode").val();
            var compName = $("#compName").val();
            var status = $("#status").val();
        
            $("#gridlist").jqGrid('setGridParam',{
                datatype:'json',
                postData:{
                    "compType":compType,
                    "areaId":areaId,
                    "compRegId":compRegId,
                    "compCode":compCode,
                    "compName":compName,
                    "status":status
                },
                page : 1
            }).trigger("reloadGrid");
        }
    </script>
</body>
</html>









